import { rewriteRouter } from './rewrite-router';
import { handleRouter } from './handle-router';

let _apps = [];
export const getApps = () => _apps;

export const registerMicroApps = apps => {
  console.log(apps);
  _apps = apps;
};

export const start = () => {
  // 微前端的运行原理：

  // 1.监听路由变化
  //   hash 路由：window.onhashchange
  //   history 路由
  //     history.go、history.back、history.forward 使用popstate 事件：window.onpopstate
  //     pushState、replaceState 需要通过函数重写的方式进行劫持
  rewriteRouter();

  
  handleRouter();
};
